<template>
  <div class="zeidianji">
    <div class="xianshiduanhuo">
      <div class="duanhuo-left">
        <router-link :to="{name: 'biguanxiulian'}">
          <img src="../../assets/img/shouye/shouye-zeidianji/biguanxiulian.png"/></router-link>
      </div>
      <div class="duanhuo-right">
        <div class="duanhuo-right-top">
          <img src="../../assets/img/shouye/shouye-zeidianji/chaobige.png"/></div>
        <div class="duanhuo-right-bottom">
          <router-link :to="{name: 'qingdan'}">
            <img src="../../assets/img/shouye/shouye-zeidianji/bimaiqingdan.png" />
          </router-link>
        </div>
      </div>
    </div>
    <h6></h6>
    <h3>即将开售</h3>
    <ul class="kaishou-ul">
      <li>
        <ul class="meizhuang-ul">
          <li>
              <h3><span></span>美妆专区<span></span></h3>
              <ul class="meizhuangchanpin-ul">
              <li v-for="good in Arr">
                <div>
                  <router-link :to="{name: 'shangpinxiangqing', params: {good}}">
                    <div class="meizhuang-img">
                      <img :src="good.src" alt="">
                    </div>
                  </router-link>
                  <h4>{{good.name}}</h4>
                  <h5>热品<span></span></h5>
                </div>
                <h5>即将开始</h5>
                <h5>倒计时: <span>00</span>时<span>00</span>分<span>00</span>秒</h5>
              </li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
    <a @click="more()">加载更多</a>
    <div class="up" @click="toTop()" v-if="isUP">
      <img src="../../assets/img/shouye/tuijian-xuanliyanzhuang/toTop.png"/>
    </div>
  </div>
</template>
<script>
  import Vue from 'vue'
  export default {
    data () {
      return {
        isUP: false,
        Arr: [],
        arr: []
      }
    },
    methods: {
      toTop () {
        if(document.documentElement){
          document.documentElement.scrollTop = 0;
        }else{
          document.body.scrollTop = 0;
        }
      },
      menu() {
        this.scroll = document.documentElement.scrollTop || document.body.scrollTop;
        if(this.scroll > 0){
          //显示 a 标签
          this.isUP = true;
        }else{
          //隐藏 a 标签
          this.isUP = false;
        }
      },
      top () {
        window.scrollTo(0,0)
      },
      tuijianGet() {
        //  发起get请求
        //  设置代理服务器转发的域
        Vue.axios.get('/api/get', {
//              get传递的query参数
//            params: {
//              name: 'along',
//              age: 32
//            }
        }).then( (response) => {
          //  成功之后的回调
//          console.log(response.data);
          this.arr = response.data;
//          console.log(this.arr);
          for (let i = 0 ; i < this.arr.length; i ++) {
            if (this.arr[i].fc === '贼惦记') {
              this.Arr.push(this.arr[i]);
            }
          }
        }).catch( (error) => {
          //  请求出错的处理
          console.log(error)
        });
      },
      more () {
        this.Arr = this.arr;
      }
    },
    mounted() {
      window.addEventListener('scroll', this.menu);
      this.tuijianGet();
    },
    created () {
      this.top();
    }
  }
</script>
<style scoped>
  .zeidianji {
    margin-top: 2rem;
    padding-bottom: 3rem;
    position: relative;
    width: 100%;
  }
  .zeidianji .xianshiduanhuo{
    width: 100%;
    display: flex;
    border-top: 1px solid #cccccc;
    border-bottom: 1px solid #cccccc;
    padding-top: 0.2rem;
  }
  .zeidianji .duanhuo-left{
    text-align: center;
    flex: 1;
  }
  .zeidianji .duanhuo-left img{
    width: 5rem;
    font-size: 0;
  }
  .zeidianji .duanhuo-right{
    text-align: center;
    flex: 1;
  }
  .zeidianji .duanhuo-left{
    border-right: 1px solid #cccccc;
  }
  .zeidianji .duanhuo-right-top {
    border-bottom: 1px solid #cccccc;
  }
  .zeidianji .duanhuo-right img{
    width: 6rem;
    font-size: 0;
  }
  .zeidianji>h6 {
    width: 100%;
    height: 0.4rem;
    background: #f2f2f2;
  }
  .zeidianji>h3{
    text-align: center;
    font-family: MicrosoftYaHei;
    font-size: 1rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #e53e42;
    margin: 0.5rem 0;
  }
  .meizhuang-ul h3{
    text-align: center;
    font-family: MicrosoftYaHei;
    font-size: 0.9rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
    margin-bottom: 0.1rem;
  }
  .meizhuang-ul h3>span{
    display: inline-block;
    width: 1rem;
    height: 0.3rem;
    border-top: 1px solid #ccc;
    margin: 0 0.3rem;
  }
  .meizhuangchanpin-ul {
    margin-left: 0.5rem;
  }
  .meizhuangchanpin-ul li {
    text-align: center;
    width: 5rem;
    height: 7rem;
    display: inline-block;
  }
  .meizhuangchanpin-ul li div{
    margin: 0 0.2rem;
    border: 1px solid #ccc;
    position: relative;
    /*height: 6rem;*/
  }
  .meizhuangchanpin-ul li div h5{
    width: 0.6rem;
    padding: 0.1rem 0.1rem 0.2rem 0.1rem;
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #ffffff;
    background: #e53e42;
    position: absolute;
    top: -0.11rem;
    left: -0.05rem;
  }
  .meizhuangchanpin-ul li div h5 span{
    display: inline-block;
    border: 0.4rem solid #fff;
    border-left-color: transparent;
    border-top-color: transparent;
    border-right-color: transparent;
    position: absolute;
    bottom: -1px;
    left: 0;
  }
  .meizhuangchanpin-ul li .meizhuang-img{
    padding: 0.8rem 0;
    width: 4rem;
    height: 3rem;
    margin: 0 auto;
    border: 0;
  }
  .meizhuangchanpin-ul li .meizhuang-img img {
    max-width: 4rem;
    max-height: 3rem;
    vertical-align: middle;
    line-height: 3rem;
  }
  .meizhuangchanpin-ul li h4{
    font-family: SimHei;
    font-size: 0.5rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
  }
  .meizhuangchanpin-ul li h5 {
    text-align: left;
    font-family: SimHei;
    font-size: 0.3rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
    transform: scale(0.9);
  }
  .meizhuangchanpin-ul li h5 span {
    color: #e53e42;
  }
  .zeidianji>a{
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1.5rem;
    letter-spacing: 0rem;
    color: #808080;
    display: block;
    text-align: center;
    width: 100%;
    height: 1.5rem;
    background: #f2f2f2;
  }
  .up {
    width: 1.5rem;
    position: fixed;
    bottom: 3rem;
    right: 0.3rem;
  }
  .up img {
    width: 100%;
  }
</style>
